var aUi = aUi || {};
aUi.review = {
	_addinventory: function(data) {
		var html = '<li class="mui-table-view-cell">' +
			'<div class="content-mid">' +
			'<div class="left-image">' +
			'<img class="" src="../../../../images/comman/icon_materials.png">' +
			'</div>' +
			'<div class="mid-text">' +
			'<div class="left-text">' +
			'<p class="cell-title">' + data.commodityname + '</p>' +
			'<p class="cell-time">' + data.creator + '</p>' +
			'</div>' +
			'<div class="right-text">' +
			'<p>x' + data.qty + '</p>' +
			'<p>' + data.createtime + '</p>' +
			'</div>' +
			'</div>' +
			'</div>' +
			'</li>';
		return html;
	},

	_detail: function(data) {
		var html = '<li class="mui-table-view-cell">' +
			'<div class="content-mid">' +
			'<div class="left-image">' +
			'<img class="" src="../../../../images/comman/icon_materials.png">' +
			'</div>' +
			'<div class="mid-text">' +
			'<div class="left-text">' +
			'<p class="cell-title">' + data.commodityname + '</p>' +
			'<p class="cell-time">' + data.creator + '</p>' +
			'</div>' +
			'<div class="right-text">' +
			'<p>x' + data.qty + '</p>' +
			'<p>' + data.createtime + '</p>' +
			'</div>' +
			'</div>' +
			'</div>' +
			'</li>';
		return html;
	},


	//复核详情列表
	_addReViewDetail: function(data) {
		var reviewQty = "0";
		var color = "";
		var none = "";
		if (data.reviewQty != null && data.reviewQty.length !=0) {
			reviewQty = data.reviewQty;
		}

		var remainAmount = parseInt(data.qty) - parseInt(reviewQty);
		var state = "未完成";
		if (remainAmount <= 0) {
			state = "已完成";
			color = "#0091FF"
			none = "none"
		}
		
		var  specification =  data.specification?data.specification:"";
        var   unitPrice  =  data.unitPrice!=null ? data.unitPrice : "";
 
			
		var html = '<li  data-specification="' + specification + '"   data-unitPrice="' + unitPrice + '"  data-suppliername="' + data.suppliername + '" data-commodityname="' + data.commodityname + '"  data-reviewQty="' + data.reviewQty + '" data-qty="' + data.qty + '" data-id="' + data.id + '" data-commoditybar="' + data.commoditybar + '" data-locatorcode="' + data.locatorcode +
			'" class="mui-table-view-cell mui-media item-cell" style="display:'+none+';">' +
			'<div class="content-top">' +
			'<div class="top-title">商品编码：' + data.commoditybar + '</div>' +
			'</div>' +
			'<div class="top-line"></div>' +
			'<div class="content-mid">' +
			'<div class="left-image">' +
			'<img class="" src="../../../../images/comman/icon_materials.png">' +
			'</div>' +
			'<div class="mid-text">' +
			'<div class="left-text">' +
			'<p class="cell-title">' + data.commodityname + '</p>' +
			'<p class="cell-time">规格：' + specification + '</p>' +
			'</div>' +
			'<div class="right-text">' +
			'<p  style="color:'+color+'">' + state + '</p>' +
			'<p >已核数量：' + reviewQty + '</p>' +
			'</div>' +
			'</div>' +
			'</div>' +
			'<div class="top-line2"></div>' +
			'<div class="bottom-content">' +
			'<div class="user">' +
			'<div class="avarimage">' +
			'<img class="" src="../../../../images/comman/icon_materials.png">' +
			'</div>' +
			'<div class="name">单价：' + unitPrice + '</div>' +
			'</div>' +
			'<div class="time">总核对数量：' + data.qty + '</div>' +
			'</div>' +
			'</li>';
		return html;
	},
	
	
	//一个商品复核详情
	_addOneReViewDetail: function(data) {
		var reviewQty = "0";
		var color = "";
		if (data.reviewQty != null && data.reviewQty.length !=0) {
			reviewQty = data.reviewQty;
		}
		var remainAmount = parseInt(data.qty) - parseInt(reviewQty);
		var state = "未完成";
		if (remainAmount <= 0) {
			state = "已完成";
			color = "#0091FF"
		}
		
		var unitPrice  = data.unitPrice!=null ? data.unitPrice : ""; 
		var specification  = data.specification?data.specification:"";
		
		var html = '<li data-specification="' + specification + '"   data-unitPrice="' + unitPrice + '"  data-commodityname="' + data.commodityname + '" data-reviewQty="' + data.reviewQty + '" data-qty="' + data.qty + '" data-id="' + data.id + '" data-commoditybar="' + data.commoditybar + '" data-locatorcode="' + data.locatorcode +
			'" class="mui-table-view-cell mui-media item-cell" style="display:;">' +
			'<div class="content-top">' +
			'<div class="top-title">商品编码：' + data.commoditybar + '</div>' +
			'</div>' +
			'<div class="top-line"></div>' +
			'<div class="content-mid">' +
			'<div class="left-image">' +
			'<img class="" src="../../../../../images/comman/icon_materials.png">' +
			'</div>' +
			'<div class="mid-text">' +
			'<div class="left-text">' +
			'<p class="cell-title">' + data.commodityname + '</p>' +
			'<p class="cell-time">规格：' + specification + '</p>' +
			'</div>' +
			'<div class="right-text">' +
			'<p  style="color:'+color+'">' + state + '</p>' +
			'<p >已核数量：' + reviewQty + '</p>' +
			'</div>' +
			'</div>' +
			'</div>' +
			'<div class="top-line2"></div>' +
			'<div class="bottom-content">' +
			'<div class="user">' +
			'<div class="avarimage">' +
			'<img class="" src="../../../../../images/comman/icon_materials.png">' +
			'</div>' +
			'<div class="name">单价：' + unitPrice + '</div>' +
			'</div>' +
			'<div class="time">总核对数量：' + data.qty + '</div>' +
			'</div>' +
			'</li>';
		return html;
	},
	
	 // 复合全部的物料明细
	_addReViewAllDetail: function(data) {
		var reviewQty = "0";
		var color = "";
		if (data.reviewQty != null && data.reviewQty.length !=0) {
			reviewQty = data.reviewQty;
		}
		var remainAmount = parseInt(data.qty) - parseInt(reviewQty);
		var state = "未完成";
		if (remainAmount <= 0) {
			state = "已完成";
			color = "#0091FF"
		}
		var unitPrice  = data.unitPrice!=null ? data.unitPrice : ""; 
		var specification  = data.specification?data.specification:"";
		
		var html = '<li data-reviewQty="' + data.reviewQty + '" data-qty="' + data.qty + '" data-id="' + data.id + '" data-commoditybar="' + data.commoditybar + '" data-locatorcode="' + data.locatorcode +
			'" class="mui-table-view-cell mui-media item-cell" style="display:;">' +
			'<div class="content-top">' +
			'<div class="top-title">商品编码：' + data.commoditybar + '</div>' +
			'</div>' +
			'<div class="top-line"></div>' +
			'<div class="content-mid">' +
			'<div class="left-image">' +
			'<img class="" src="../../../../../images/comman/icon_materials.png">' +
			'</div>' +
			'<div class="mid-text">' +
			'<div class="left-text">' +
			'<p class="cell-title">' + data.commodityname + '</p>' +
			'<p class="cell-time">规格：' + specification + '</p>' +
			'</div>' +
			'<div class="right-text">' +
			'<p  style="color:'+color+'">' + state + '</p>' +
			'<p >已核数量：' + reviewQty + '</p>' +
			'</div>' +
			'</div>' +
			'</div>' +
			'<div class="top-line2"></div>' +
			'<div class="bottom-content">' +
			'<div class="user">' +
			'<div class="avarimage">' +
			'<img class="" src="../../../../../images/comman/icon_materials.png">' +
			'</div>' +
			'<div class="name">单价：' + unitPrice + '</div>' +
			'</div>' +
			'<div class="time">总核对数量：' + data.qty + '</div>' +
			'</div>' +
			'</li>';
		return html;
	},
	

	detailList: function(list) {
		var html = "";
		for (var i = 0; i < list.length; i++) {
			var data = list[i];
			html += this._detail(data);
		}
		return html;
	},

	reviewDetailList: function(list) {
		var html = "";
		for (var i = 0; i < list.length; i++) {
			var data = list[i];
			html += this._addReViewDetail(data);
		}
		return html;
	},
	
	reviewAllDetailList: function(list) {
		var html = "";
		for (var i = 0; i < list.length; i++) {
			var data = list[i];
			html += this._addReViewAllDetail(data);
		}
		return html;
	},



};
